home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_bind.idb / usr / freeware / catman / p_man / cat3b / getnetent.3.z / getnetent.3
Encoding:
Text File  |  1999-04-16  |  3.9 KB  |  85 lines

  1. GETNETENT(3)                BSD Programmer's Manual               GETNETENT(3)
  2.  
  3. NNAAMMEE
  4.      ggeettnneetteenntt, ggeettnneettbbyyaaddddrr, ggeettnneettbbyynnaammee, sseettnneetteenntt, eennddnneetteenntt - get net-
  5.      works entry
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<nneettddbb..hh>>
  9.  
  10.      _s_t_r_u_c_t _n_e_t_e_n_t _*
  11.      ggeettnneetteenntt();
  12.  
  13.      _s_t_r_u_c_t _n_e_t_e_n_t _*
  14.      ggeettnneettbbyynnaammee(_c_h_a_r _n_a_m_e);
  15.  
  16.      _s_t_r_u_c_t _n_e_t_e_n_t _*
  17.      ggeettnneettbbyyaaddddrr(_u_n_s_i_g_n_e_d _l_o_n_g _n_e_t, _i_n_t _t_y_p_e);
  18.  
  19.      _v_o_i_d
  20.      sseettnneetteenntt(_i_n_t _s_t_a_y_o_p_e_n);
  21.  
  22.      _v_o_i_d
  23.      eennddnneetteenntt();
  24.  
  25. DDEESSCCRRIIPPTTIIOONN
  26.      The ggeettnneetteenntt(), ggeettnneettbbyynnaammee(), and ggeettnneettbbyyaaddddrr() subroutines each re-
  27.      turn a pointer to an object with the following structure containing the
  28.      broken-out fields of a line in the _n_e_t_w_o_r_k_s database.
  29.  
  30.            struct  netent {
  31.                    char    *n_name;        /* official name of net */
  32.                    char    **n_aliases;    /* alias list */
  33.                    int     n_addrtype;     /* net number type */
  34.                    long    n_net;          /* net number */
  35.            };
  36.  
  37.      The members of this structure are:
  38.  
  39.      n_name      The official name of the network.
  40.  
  41.      n_aliases   A zero-terminated list of alternate names for the network.
  42.  
  43.      n_addrtype  The type of the network number returned: AF_INET.
  44.  
  45.      n_net       The network number.  Network numbers are returned in machine
  46.                  byte order.
  47.  
  48.      If the _s_t_a_y_o_p_e_n flag on a sseettnneetteenntt() subroutine is NULL, the _n_e_t_w_o_r_k_s
  49.      database is opened.  Otherwise, the sseettnneetteenntt() has the effect of rewind-
  50.      ing the _n_e_t_w_o_r_k_s database.  The eennddnneetteenntt() subroutine may be called to
  51.      close the _n_e_t_w_o_r_k_s database when processing is complete.
  52.  
  53.      The ggeettnneetteenntt() subroutine simply reads the next line while
  54.      ggeettnneettbbyynnaammee() and ggeettnneettbbyyaaddddrr() search until a matching _n_a_m_e or _n_e_t
  55.      number is found (or until EOF is encountered).  The _t_y_p_e _m_u_s_t _b_e AF_INET.
  56.      The ggeettnneetteenntt() subroutine keeps a pointer in the database, allowing suc-
  57.      cessive calls to be used to search the entire file.
  58.  
  59.      Before a wwhhiillee loop using ggeettnneetteenntt(), a call to sseettnneetteenntt() must be made
  60.      in order to perform initialization; a call to eennddnneetteenntt() must be used
  61.      after the loop.  Both ggeettnneettbbyynnaammee() and ggeettnneettbbyyaaddddrr() make calls to
  62.      sseettnneetteenntt() and eennddnneetteenntt().
  63.  
  64. FFIILLEESS
  65.      _/_e_t_c_/_n_e_t_w_o_r_k_s
  66.  
  67. DDIIAAGGNNOOSSTTIICCSS
  68.      Null pointer (0) returned on EOF or error.
  69.  
  70. SSEEEE AALLSSOO
  71.      networks(5),  RFC 1101.
  72.  
  73. HHIISSTTOORRYY
  74.      The ggeettnneetteenntt(), ggeettnneettbbyyaaddddrr(), ggeettnneettbbyynnaammee(), sseettnneetteenntt(), and
  75.      eennddnneetteenntt() functions appeared in 4.2BSD.
  76.  
  77. BBUUGGSS
  78.      The data space used by these functions is static; if future use requires
  79.      the data, it should be copied before any subsequent calls to these func-
  80.      tions overwrite it.  Only Internet network numbers are currently under-
  81.      stood.  Expecting network numbers to fit in no more than 32 bits is prob-
  82.      ably naive.
  83.  
  84. 4th Berkeley Distribution        May 20, 1996                                2
  85.